package com.nuoniu.sibanyun.entity.production;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.util.List;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.nuoniu.sibanyun.common.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 生产加工单明细
 * </p>
 *
 * @author 白强
 * @since 2021-03-18
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ma_written_instruction_detail")
@ApiModel(value="VProductionWorkDetail对象", description="生产加工单明细")
public class VProductionWorkDetail extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "公司id")
    @TableField("company_id")
    private Integer companyId;

    @ApiModelProperty(value = "账套id")
    @TableField("account_id")
    private Integer accountId;

    @ApiModelProperty(value = "主订单id")
    @TableField("order_id")
    private Integer orderId;

    @ApiModelProperty(value = "主表单据编号")
    @TableField("main_voucher_code")
    private String mainVoucherCode;

    @ApiModelProperty(value = "生产车间")
    @TableField("office_id")
    private Integer officeId;

    @ApiModelProperty(value = "生产车间名称")
    @TableField("office_name")
    private String officeName;

    @ApiModelProperty(value = "bomId")
    @TableField("bom_id")
    private Integer bomId;

    @ApiModelProperty(value = "bom版本号")
    @TableField("bom_name")
    private String bomName;

    @ApiModelProperty(value = "BOM展开方式 1:单阶 2：尾阶")
    @TableField("bom_exp_method")
    private Integer bomExpMethod;

    @ApiModelProperty(value = "工艺路线id")
    @TableField("process_route_id")
    private Integer processRouteId;

    @ApiModelProperty(value = "工艺路线名称")
    @TableField("process_route_name")
    private String processRouteName;

    @ApiModelProperty(value = "物料id（产品ID）")
    @TableField("inventory_id")
    private Integer inventoryId;

    @ApiModelProperty(value = "物料名称（产品名称）")
    @TableField("inventory_name")
    private String inventoryName;

    @ApiModelProperty(value = "物料编码（产品编码）")
    @TableField("inventory_code")
    private String inventoryCode;

    @ApiModelProperty(value = "规格型号")
    @TableField("inventory_specification")
    private String inventorySpecification;

    @ApiModelProperty(value = "条形码")
    @TableField("inventory_bar_code")
    private String inventoryBarCode;

    @ApiModelProperty(value = "预入仓库")
    @TableField("warehouse_id")
    private Integer warehouseId;

    @ApiModelProperty(value = "预入仓库名称")
    @TableField("warehouse_name")
    private String warehouseName;

    @ApiModelProperty(value = "批号")
    @TableField("bar_code")
    private String barCode;

    @ApiModelProperty(value = "销售订单号")
    @TableField("sale_order_code")
    private String saleOrderCode;

    @ApiModelProperty(value = "客户ID")
    @TableField("crm_id")
    private Integer crmId;

    @ApiModelProperty(value = "客户名称")
    @TableField("crm_name")
    private String crmName;

    @ApiModelProperty(value = "可用量")
    @TableField("available_quantity")
    private BigDecimal availableQuantity;

    @ApiModelProperty(value = "现存量")
    @TableField("existing_quantity")
    private BigDecimal existingQuantity;

    @ApiModelProperty(value = "单计量id")
    @TableField("unit_id")
    private Integer unitId;

    @ApiModelProperty(value = "计量单位组ID")
    @TableField("unit_group_id")
    private Integer unitGroupId;

    @ApiModelProperty(value = "主计量")
    @TableField("base_unit")
    private Integer baseUnit;

    @ApiModelProperty(value = "主计量名称")
    @TableField("base_unit_name")
    private String baseUnitName;


    @ApiModelProperty(value = "数量")
    @TableField("base_quantity")
    private BigDecimal baseQuantity;

    @ApiModelProperty(value = "辅计量")
    @TableField("sub_unit")
    private Integer subUnit;

    @ApiModelProperty(value = "辅计量名称")
    @TableField("sub_unit_name")
    private String subUnitName;

    @ApiModelProperty(value = "辅计量数量")
    @TableField("sub_quantity")
    private BigDecimal subQuantity;

    @ApiModelProperty(value = "换算率")
    @TableField("unit_exchange_rate")
    private BigDecimal unitExchangeRate;

    @ApiModelProperty(value = "来源单据id")
    @TableField("source_voucher_id")
    private Integer sourceVoucherId;

    @ApiModelProperty(value = "来源单据")
    @TableField("source_voucher_type")
    private String sourceVoucherType;

    @ApiModelProperty(value = "来源单据号")
    @TableField("source_voucher_code")
    private String sourceVoucherCode;

    @ApiModelProperty(value = "来源单据日期")
    @TableField("source_voucher_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate sourceVoucherDate;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    private String remarks;

    @ApiModelProperty(value = "开工日期")
    @TableField("start_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate startDate;

    @ApiModelProperty(value = "完工日期")
    @TableField("finish_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate finishDate;

    @ApiModelProperty(value = "预计开工日期")
    @TableField("expect_start_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate expectStartDate;

    @ApiModelProperty(value = "预计完工日期")
    @TableField("expect_finish_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate expectFinishDate;

    @ApiModelProperty(value = "累计入库数量")
//    @TableField("cum_in_quantity")
    private BigDecimal cumInQuantity;

    @ApiModelProperty(value = "来源明细ID")
    @TableField("source_detail_id")
    private Integer sourceDetailId;

    @ApiModelProperty(value = "自定义字段数据")
    @TableField("define_fields")
    private String defineFields;

    @ApiModelProperty(value = "累计执行数量")
    @TableField(exist = false)
    private BigDecimal cumExecuteQuantity;

    @ApiModelProperty(value = "累计执行情况")
    @TableField(exist = false)
    private String cumExecuteJson;

    @ApiModelProperty(value = "累计派遣数量-废弃")
//    @TableField("cum_dispatch_quantity")
    private BigDecimal cumDispatchQuantity;

    @ApiModelProperty(value = "加工--材料明细")
    @TableField(exist = false)
    private List<VProductionWorkInventoryDetail> productionWorkInventoryDetailList;

    @ApiModelProperty(value = "加工--工序明细")
    @TableField(exist = false)
    private List<VProductionWorkProcedureDetail> productionWorkProcedureDetailList;



    /************************************  委外加工 ***************************************/

    @ApiModelProperty(value = "税率%")
    @TableField("tax_rate")
    private BigDecimal taxRate;

    @ApiModelProperty(value = "单价")
    @TableField("price")
    private BigDecimal price;

    @ApiModelProperty(value = "金额")
    @TableField("amount")
    private BigDecimal amount;

    @ApiModelProperty(value = "税额(合计)")
    @TableField("tax")
    private BigDecimal tax;

    @ApiModelProperty(value = "含税单价")
    @TableField("include_tax_price")
    private BigDecimal includeTaxPrice;

    @ApiModelProperty(value = "含税金额")
    @TableField("include_tax_amount")
    private BigDecimal includeTaxAmount;

    @ApiModelProperty(value = "工序ID")
    @TableField("procedure_id")
    private Integer procedureId;

    @ApiModelProperty(value = "工序名称")
    @TableField("procedure_name")
    private String procedureName;





}
